<!doctype html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="maximum-scale=1.0,minimum-scale=1.0,user-scalable=0,width=device-width,initial-scale=1.0"/>
    <title></title>
    <link rel="stylesheet" type="text/css" href="css/api.css"/>
    <script type="text/javascript" src="../script/jquery.js"></script>

    <style>
    body, div, dl, dt, dd, ul, ol, li, h1, h2, h3, h4, h5, h6, pre, code, form, fieldset, legend, input, button, textarea, p, blockquote, th, td {
	    margin: 0px;
	    padding: 0px;
	}
        html, body {
            height: 100%;
            width: 100%;
        }

        #wrap {
            height: 100%;
            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
            -webkit-box-orient: vertical;
            -webkit-flex-flow: column;
            flex-flow: column;
        }

        #main {
            -webkit-box-flex: 1;
            -webkit-flex: 1;
            flex: 1;
        }

        #footer {
            width: 100%;
            text-align: center;
            height: 56px;
            line-height: 55px;
            background-color: #f2f2f2;
        }
		#headercxd{
		 width:100%;
		}
        ul {

            display: -webkit-box;
            display: -webkit-flex;
            display: flex;
        }

        .cloud {
            background-image: url(image/bottombtn0101.png);
        }

        .client {
            background-image: url(image/bottombtn0201.png);
        }

        .dev {
            background-image: url(image/bottombtn0301.png);
        }

        .doc {
            background-image: url(image/bottombtn0401.png);
        }

        #footer li {
            -webkit-box-flex: 1;
            -webkit-flex: 1;
            flex: 1;
            height: 55px;
        }

        .bottom_btn {
            background-position-y: 4px;
            padding-top: 16px;
            font-size: 12px;
            color: #323237;
            width: 99%;
            height: 39px;
            background-repeat: no-repeat no-repeat;
            background-position-x: center;
            background-size: 30px;
        }

        .active .cloud {
            background-image: url(image/bottombtn0102.png);
        }

        .active .client {
            background-image: url(image/bottombtn0202.png);
        }

        .active .dev {
            background-image: url(image/bottombtn0302.png);
        }

        .active .doc {
            background-image: url(image/bottombtn0402.png);
        }

        .active .bottom_btn {
            color: #6ab494;
            background-size: 30px;
        }

        .topbar {
            background: #f8285c;
            width:100%;
            height: 50px;
            border-bottom: 1px solid #DDDFE3;
            line-height: 50px;
            text-align: center;
            display: none;
            color: #FFF;
        }

        .activebar {
            display: block;
        }
    </style>
</head>
<body>
<div id="wrap">
    <header id="headercxd">

        <div id="cloud" class="topbar  activebar">

            首页
        </div>
        
    </header>
    <div id="main">

    </div>
    <div id="footer">
        <ul>
            

            
        </ul>
    </div>
</div>
</body>




<script type="text/javascript" src="../script/api.js"></script>
<!--<script type="text/javascript">
    apiready = function () {
        var $header = $api.dom('header');
        $api.fixIos7Bar($header);
        var $body = $api.dom('body');
        var $footer = $api.byId('footer');
        var header_h = $api.offset($header).h;
        var body_h = $api.offset($body).h;
        var footer_h = $api.offset($footer).h;
        var rect_h = body_h - header_h - footer_h;
        var pageParam = api.pageParam;
        api.openFrame({
		    name: 'page2',
		    url: pageParam.el,
		    rect: {x: 0, y: header_h, w: 'auto', h: rect_h},
		    pageParam: {name: 'test'},
		    bounces: true,
		    bgColor: 'rgba(0,0,0,0)',
		    vScrollBarEnabled:true,
		    hScrollBarEnabled:true
		});
    };

</script>
-->
<script type="text/javascript">
    apiready = function(){	
    	api.showProgress({
	        title: '加载中...',
	        modal: true
	    });
    	
    	
    	
    	api.setRefreshHeaderInfo({
	        visible: true,
	        // loadingImgae: 'wgt://image/refresh-white.png',
	        bgColor: '#f2f2f2',
	        textColor: '#4d4d4d',
	        textDown: '下拉刷新...',
	        textUp: '松开刷新...',
	        showTime: true
	    }, function(ret, err){
	    	initPage();
	    });
    	
    	
    	
    	
    	var url = location.search; //获取url中"?"符后的字串
    	var $header = $api.dom('header');	
			var header_h = $api.offset($header).h;
			var $body = $api.dom('body');
	        var $footer = $api.byId('footer');
	        var header_h = $api.offset($header).h;
	        var body_h = $api.offset($body).h;
	        var footer_h = $api.offset($footer).h;
	        var rect_h = body_h - header_h - footer_h;
	   var theRequest = new Object();
	   if (url.indexOf("?") != -1) {
	      var str = url.substr(1);     
	      strs = str.split("=");
	      for(var i = 0; i < strs.length; i ++) {
	      
	         theRequest[strs[i].split("=")[0]]=unescape(strs[i].split("=")[2]);
	      }
	   }
	   var id = strs[1].split("=")[0];	
	api.ajax({
		url: 'http://www.xinpinghui.com/index.php/api/getandorid',
	  	method: 'post',
	 	cache: false,
	  	timeout: 30,
	  	dataType: 'json',
	  	data: {
	    	values:{id: id}
	  	}
		},function(ret,err){
			
			if (ret) {
			//alert(ret.title);
			//str ='<div class="cardtitle isoarea">'+ret.id+''+ret.title+'</div><div class="cardcon isoarea2">'+ret.body+'</div><div class="cardcon isoarea2"><span class="jian">减</span>'+ret.description+'</div>';
			//$api.byId('cloud').innerHTML = ret.title);
			//$api.byId('cloud').HTML = ret.title;
			$('#cloud').html(ret.title);
			//alert(rect_h);
			

			api.openFrame({
			    name: 'page2',
			    url: ret.android_click_url,
			    //rect: {x: 0, y: header_h, w: 'auto', h:  rect_h},
			    rect: {x: 0, y: header_h, w: 'auto', h: rect_h},
			    //pageParam: {name: 'test'},
			    bounces: true,
			    bgColor: 'rgba(F,0,0,0)',
			    vScrollBarEnabled:true,
			    hScrollBarEnabled:true
			});					
		} else {
			api.alert({
				msg : ('错误码：'+err.code+'；错误信息：'+err.msg+'网络状态码：'+err.statusCode)
		    });
		};
	});	
}


</script>

</html>